__author__ = 'l4537'
#coding:utf-8
import re,json
a = open("1.txt","r",encoding="utf-8")
def Re(res,total,id = "1"):
    #1.普通模式正则，2，多行模式正则
    if id == "1":
        data = re.findall(str(res),total)
    if id == "2":
        data = re.findall(str(res),total,re.S)
    return data
data = Re("(slot\s\d+:)((\s+\S+){16})",a.read(),"2")
# 老的data = Re("===========((\s+\S+){16})",a.read(),"2")
list= []
for i in data:
    list.append(i[0])
list = set(list)
slotdata = {}
for i in list:
    alist = ""
    num = Re("\d+", i)
    slotdata[int(num[0])] = {}
    for k in data:
        if i == k[0]:
            alist  = alist + k[1]
    a = 0
    for zzz in Re("\s+(\S+)",alist):
        slotdata[int(num[0])][a] = zzz
        a += 1
    alist = ""
print(slotdata)
print(slotdata[1][38])